import { LAYER_CHANGE_TYPE } from "../common/GameConfig";
import LayerStatic from "../common/LayerStatic";
import PanelBase from "../common/PanelBase";
import EventManager from "../core/event/EventManager";
import { Event_Name } from "../core/event/event_mgr";


const { ccclass, property } = cc._decorator;

@ccclass
export default class Over extends PanelBase {

    // @property
    // text: string = 'hello';

    onLoad() {
        LayerStatic.Instance.setOverStatic(this);
    }

    protected onEnable(): void {
        super.onEnable();
        // globalThis.GAME_GLOBAL.levelGrade = 1;
    }

    start() {

    }

    protected onDestroy(): void {
        LayerStatic.Instance.setOverStatic(null);
    }

    private onRechange() {
        this.onClose();
        LayerStatic.GameStatic.restartGame();
    }

    private goHomeCallback() {
        EventManager.Instance.emit(Event_Name.LAYER_CHANGE, LAYER_CHANGE_TYPE.OVER_TO_WELCOME);
    }

    // update (dt) {}
}
